Skip to content

Fix for 22822 ComputedStates example#23655

Merged
alice-i-cecile merged 2 commits intobevyengine:mainfrom
scottgshannon:22822-computed-states-example
Apr 6, 2026
Merged

Fix for 22822 ComputedStates example#23655
alice-i-cecile merged 2 commits intobevyengine:mainfrom
scottgshannon:22822-computed-states-example

Conversation

@scottgshannon
Copy link
Copy Markdown
Contributor

Objective

Solution

  • Adds ALLOW_SAME_STATE_TRANSITIONS = false to ComputedStates in computed_states example

Testing

Fixes bevyengine#22822 by adding ALLOW_SAME_STATE_TRANSITIONS = false to ComputedStates in example
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

Welcome, new contributor!

Please make sure you've read our contributing guide, as well as our policy regarding AI usage, and we look forward to reviewing your pull request shortly ✨

@alice-i-cecile alice-i-cecile added this to the 0.19 milestone Apr 4, 2026

impl ComputedStates for TurboMode {
type SourceStates = AppState;
const ALLOW_SAME_STATE_TRANSITIONS: bool = false;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you verify that you actually don’t need this line:

Suggested change
const ALLOW_SAME_STATE_TRANSITIONS: bool = false;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TurboMode can be re-entered (via activating turbo then pausing). This produces duplicate UI elements that overlap and thus don't cause visual artifacts.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see, I overlooked that, thank you for pointing that out


impl ComputedStates for IsPaused {
type SourceStates = AppState;
const ALLOW_SAME_STATE_TRANSITIONS: bool = false;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you verify that you actually don’t need this line:

Suggested change
const ALLOW_SAME_STATE_TRANSITIONS: bool = false;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While IsPaused cannot be re-entered it is tied to an OnEnter system that performs command.spawn calls like the other computed states. This line could be removed and retain proper behavior but I believe the example is stronger by keeping it.

@kfc35 kfc35 added D-Trivial Nice and easy! A great choice to get started with Bevy C-Examples An addition or correction to our examples S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged A-States App-level states machines labels Apr 4, 2026
Co-authored-by: Kevin Chen <chen.kevin.f@gmail.com>
Copy link
Copy Markdown
Contributor

@kfc35 kfc35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your first contribution!

@kfc35 kfc35 added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Apr 4, 2026
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Apr 6, 2026
Merged via the queue into bevyengine:main with commit c6a115c Apr 6, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-States App-level states machines C-Examples An addition or correction to our examples D-Trivial Nice and easy! A great choice to get started with Bevy S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

computed_states example broken

4 participants